package com.shumei.servlet;

import com.shumei.DAO.ProductDAO;
import com.shumei.DAO.impl.ProductDAOImpl;
import com.shumei.pojo.Product;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/t1")
public class ThDemo1 extends ViewBaseServlet{

    ProductDAO productDAO=new ProductDAOImpl();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        String s="qqqq";
//        req.setAttribute ("hello",s);
//        super.processTemplate("demo1",req,resp);
        List<Product> productlist= productDAO.getProductList();
        req.setAttribute("products",productlist);
        super.processTemplate("demo2", req, resp);
    }
//    @Override
//    protected void doPost(HttpServletRequest req, HttpServletResponse resp)throws ServletException, IOException {
//        this.doGet(req,resp);
//  }

}
